import { ImageResponse } from 'next/og'; import { Fallback, Wallpaper } from '@/components/brand/og'; import { apiD1, safe } from '@/lib/api'; import { fmtDate, fmtInt, fmtParams, num } from '@/lib/format'; import { routes, SITE_NAME } from '@/lib/site'; export const runtime = 'nodejs'; export const alt = `Model family on ${SITE_NAME}`; export const size = { width: 1200, height: 630 }; export const contentType = 'image/png'; export default async function FamilyOgImage({ params }: { params: Promise<{ slug: string }> }) { const { slug } = await params; const f = await safe(apiD1.family(slug, 5)); if (!f) return new ImageResponse(, { ...size }); const counters: [string, string][] = [['Models', fmtInt(f.model_count)]]; if (f.first_release) counters.push(['First release', fmtDate(f.first_release)]); if (f.last_release) counters.push(['Latest release', fmtDate(f.last_release)]); if (f.param_range && num(f.param_range.min) !== null && num(f.param_range.max) !== null) counters.push(['Parameters', num(f.param_range.min) === num(f.param_range.max) ? fmtParams(f.param_range.min) : `${fmtParams(f.param_range.min)} – ${fmtParams(f.param_range.max)}`]); const subtitle = [f.modalities?.length ? f.modalities.join(', ') : null, f.licenses?.length ? `licences: ${f.licenses.slice(0, 3).map((l) => l.key).join(', ')}` : null, num(f.artifacts_count) ? `${fmtInt(f.artifacts_count)} artifacts` : null].filter(Boolean).join(' · ') || 'Releases, members, lineage and benchmark progress.'; return new ImageResponse(, { ...size }); }